w*s 发帖数: 7227 | 1 var spawn = require('child_process').spawn;
// exec 2 commands 1 by 1
var child1 = spawn('cmd1', ['argu1']);
var child2 = spawn('cmd2', ['argu2']);
怎样保证cmd1执行完毕了再执行cmd2 ?
(如果是shell我就这么写,
/home/wds# cmd1 argu1; cmd2 argu2)
上班一天很累啦,求大牛们直接告诉答案。谢谢! |
|
J*****n 发帖数: 4859 | 2 I am trying to install ntlm package. setup file is in following link
http://code.google.com/p/python-ntlm/source/browse/trunk/python
Then I got
Traceback (most recent call last):
File "C:/Python25/install_ntlm", line 26, in
install_requires = DEPENDENCIES,
File "C:\Python25\lib\distutils\core.py", line 139, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: install_ntlm [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_
opts] ...]
or:... 阅读全帖 |
|
w********e 发帖数: 557 | 3 cmd1
if 'echo $?' != 0, exit
cmd2
if 'echo $?' != 0, exit
..
..
Put them all in one text file and make it executable. |
|
S*A 发帖数: 7142 | 4 cmd1 以后 fork, 后台执行一个 bash, bash 里面跑 sleep 10; script-1.
sh -c "sleep 10; script-1" & |
|
B****g 发帖数: 83 | 5 // ================================================
var spawn = require('child_process').spawn;
var async = require('async');
function spawnFunc(options, cb) {
var child = spawn(options.cmd, options.args, function);
var result = '';
child.stdout.on('data', function (data) {
// do some stuff with stdout data
result += data;
});
child.stderr.on('data', function (data) {
// do some stuff with stderr data
});
child.on('close', function (code) {
// error
if (code !==... 阅读全帖 |
|
s*******k 发帖数: 71 | 6
AutoComplete for a command line processor works like the following: suppose
you have two files file1.c and happy.h under the current directory. You
want to edit file1.c, then you type in "vim" :-)), space, "f", and then
press TAB, the commandline processor should fill in "ile1.c" for you, since
it only finds one file under the current directory starting with "f".
Another usage: if you have three programs in your path: cmd1, happy2, t3,
and you want to run happy2, then you type in "h" and press |
|
c*****t 发帖数: 1879 | 7 Just put in a text file (say test.sh)
cmd1
cmd2
cmd3
...
Then run
sh test.sh |
|