Skip to content
Myr

More nicer error handling

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Way, No · committed by Way, No · parent fc560de · Browse files · 1 file+6 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−5 removed

  • other:+6 added−5 removed

1 file+6 added−5 removed

modified:index.js+6 added-5 removed
403 unmodified lines
404 var bin = basename(argv[1]) + '-' + args[0];405406 // check for ./<bin> first407 var local = path.join(dir, bin);408 if (exists(local)) bin = local;408409 // run it410 args = args.slice(1);412 var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });413 proc.on('exit', function(code){414 if (code == 127) {415 console.error('\n %s(1) does not exist\n', bin);411 var proc = spawn(local, args, { stdio: 'inherit', customFds: [0, 1, 2] });412 proc.on('error', function(err){413 if (err.code == "ENOENT") {414 console.error('\n %s(1) does not exist, try --help\n', bin);415 } else if (err.code == "EACCES") {416 console.error('\n %s(1) not executable. try chmod or run with root\n', bin);417 }418 });419};420
733 unmodified lines