Skip to content

Commit

Permalink
v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FvckSh1t committed Dec 13, 2013
1 parent c35e045 commit 284fb26
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
5 changes: 0 additions & 5 deletions index.js

This file was deleted.

21 changes: 8 additions & 13 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
var exec = require('child_process').exec;

module.exports = function s(argv, done) {
var cmds = argv.slice(2),
sudo = exec('sudo ' + argv.join(' '));
module.exports = function(segs, done) {
if (segs.length < 1) done(null);
var cmd = 'sudo ' + segs.join(' '),
sudo = exec(cmd);

sudo.on('error', function(err) {
if (done) done(err);
});
sudo.on('exit', function() {
if (done) done(null);
});
sudo.on('close', function() {
if (done) done(null);
});
sudo.on('error', done);
sudo.on('exit', done);
sudo.on('close', done);

process.stdin.pipe(sudo.stdin);
sudo.stdout.pipe(process.stdout);

//sudo.stderr.pipe(process.stderr);
sudo.stderr.on('data', function(chunk) {
if (chunk.toString() == 'Sorry, try again.\n') return;
if (chunk.toString() === 'Sorry, try again.\n') return;
process.stdout.write(chunk);
});
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sd",
"version": "0.0.1",
"version": "0.0.2",
"bin": {
"s": "./bin/sd",
"sd": "./bin/sd"
Expand All @@ -9,19 +9,20 @@
"description": "A CLI tool for convinence of `sudo` on Linux",
"repository": {
"type": "git",
"url": "https://github.com/Fritz-Lium/s"
"url": "https://github.com/Fritz-Lium/sd"
},
"keywords": [
"linux",
"cmd",
"bin",
"sudo",
"sd",
"s"
],
"author": "Fritz-Lium <[email protected]> (https://github.com/Fritz-Lium)",
"license": "MIT",
"bugs": {
"url": "https://github.com/Fritz-Lium/s/issues"
"url": "https://github.com/Fritz-Lium/sd/issues"
},
"homepage": "https://github.com/Fritz-Lium/s"
"homepage": "https://github.com/Fritz-Lium/sd"
}

0 comments on commit 284fb26

Please sign in to comment.