Last active
October 28, 2015 02:17
-
-
Save geta6/1863dbecfbf5d3e8bce1 to your computer and use it in GitHub Desktop.
Revisions
-
geta6 renamed this gist
Oct 28, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
geta6 revised this gist
Oct 28, 2015 . 1 changed file with 29 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ gulp.task('exec', () => { const exec = { exec(command, options) { return new Promise((resolve, reject) => { cp.spawn(command, options, {stdio: 'inherit'}).on('error', reject).on('exit', resolve); }); }, local(commands) { return this.exec(process.env.SHELL, ['-c', commands.join('&&')]); }, remote(commands) { return this.exec('ssh', [process.env.REMOTE_HOST, commands.join('&&')]); }, }; exec.local([ 'pwd', 'ls', ]).then(() => { return exec.remote([ 'pwd', 'ls', ]); }).catch(err => { console.error(err.stack); }); }); -
geta6 revised this gist
Oct 28, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,5 +24,4 @@ gulp.task('exec', async () => { 'pwd', 'ls', ]); }); -
geta6 created this gist
Oct 28, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ gulp.task('exec', async () => { const exec = { exec(command, options) { return new Promise((resolve, reject) => { cp.spawn(command, options, {stdio: 'inherit'}).on('error', reject).on('exit', resolve); }); }, async local(commands) { await this.exec(process.env.SHELL, ['-c', commands.join('&&')]); }, async remote(commands) { await this.exec('ssh', [process.env.REMOTE_HOST, commands.join('&&')]); }, }; await exec.local([ 'pwd', 'ls', ]); await exec.remote([ 'pwd', 'ls', ]); });