mirror of
https://github.com/actions/toolkit
synced 2025-05-09 16:43:02 +00:00
Add exec (#10)
* Add exec * Fix linux tests * unnecessary dependency * Dont prefix ExecOptions with I * Consistency nits * Respond to feedback * Add toolrunner explanatory quote * Format
This commit is contained in:
parent
8ebbf59cb3
commit
c5f27c3c1b
13 changed files with 1609 additions and 0 deletions
35
packages/exec/__tests__/scripts/wait-for-file.js
Normal file
35
packages/exec/__tests__/scripts/wait-for-file.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
var fs = require('fs');
|
||||
|
||||
// get the command line args that use the format someArg=someValue
|
||||
var args = {};
|
||||
process.argv.forEach(function (arg) {
|
||||
var match = arg.match(/^(.+)=(.*)$/);
|
||||
if (match) {
|
||||
args[match[1]] = match[2];
|
||||
}
|
||||
});
|
||||
|
||||
var state = {
|
||||
file: args.file
|
||||
};
|
||||
|
||||
if (!state.file) {
|
||||
throw new Error('file is not specified');
|
||||
}
|
||||
|
||||
state.checkFile = function (s) {
|
||||
try {
|
||||
fs.statSync(s.file);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code == 'ENOENT') {
|
||||
return;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
setTimeout(s.checkFile, 100, s);
|
||||
};
|
||||
|
||||
state.checkFile(state);
|
Loading…
Add table
Add a link
Reference in a new issue