mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 18:23:16 +08: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:
@@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set index=0
|
||||
|
||||
:check_arg
|
||||
set arg=%1
|
||||
if not defined arg goto :eof
|
||||
set "arg=%arg:"=<quote>%"
|
||||
echo args[%index%]: "%arg%"
|
||||
set /a index=%index%+1
|
||||
shift
|
||||
goto check_arg
|
||||
14
packages/exec/__tests__/scripts/print-args-exe.cs
Normal file
14
packages/exec/__tests__/scripts/print-args-exe.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
namespace PrintArgs
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
for (int i = 0 ; i < args.Length ; i++)
|
||||
{
|
||||
Console.WriteLine("args[{0}]: '{1}'", i, args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
packages/exec/__tests__/scripts/stderroutput.js
Normal file
1
packages/exec/__tests__/scripts/stderroutput.js
Normal file
@@ -0,0 +1 @@
|
||||
process.stderr.write('this is output to stderr');
|
||||
1
packages/exec/__tests__/scripts/stdoutoutput.js
Normal file
1
packages/exec/__tests__/scripts/stdoutoutput.js
Normal file
@@ -0,0 +1 @@
|
||||
process.stdout.write('this is output to stdout');
|
||||
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);
|
||||
Reference in New Issue
Block a user