mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
Trace process error in RunnerService.js (#955)
This commit is contained in:
committed by
TingluoHuang
parent
3e33b4c5f2
commit
be598f1e9b
@@ -16,11 +16,11 @@ if (supported.indexOf(process.platform) == -1) {
|
|||||||
var stopping = false;
|
var stopping = false;
|
||||||
var listener = null;
|
var listener = null;
|
||||||
|
|
||||||
var runService = function() {
|
var runService = function () {
|
||||||
var listenerExePath = path.join(__dirname, '../bin/Runner.Listener');
|
var listenerExePath = path.join(__dirname, '../bin/Runner.Listener');
|
||||||
var interactive = process.argv[2] === "interactive";
|
var interactive = process.argv[2] === "interactive";
|
||||||
|
|
||||||
if(!stopping) {
|
if (!stopping) {
|
||||||
try {
|
try {
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
console.log('Starting Runner listener interactively');
|
console.log('Starting Runner listener interactively');
|
||||||
@@ -30,8 +30,8 @@ var runService = function() {
|
|||||||
listener = childProcess.spawn(listenerExePath, ['run', '--startuptype', 'service'], { env: process.env });
|
listener = childProcess.spawn(listenerExePath, ['run', '--startuptype', 'service'], { env: process.env });
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Started listener process');
|
console.log(`Started listener process, pid: ${listener.pid}`);
|
||||||
|
|
||||||
listener.stdout.on('data', (data) => {
|
listener.stdout.on('data', (data) => {
|
||||||
process.stdout.write(data.toString('utf8'));
|
process.stdout.write(data.toString('utf8'));
|
||||||
});
|
});
|
||||||
@@ -40,6 +40,10 @@ var runService = function() {
|
|||||||
process.stdout.write(data.toString('utf8'));
|
process.stdout.write(data.toString('utf8'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
listener.on("error", (err) => {
|
||||||
|
console.log(`Runner listener fail to start with error ${err.message}`);
|
||||||
|
});
|
||||||
|
|
||||||
listener.on('close', (code) => {
|
listener.on('close', (code) => {
|
||||||
console.log(`Runner listener exited with error code ${code}`);
|
console.log(`Runner listener exited with error code ${code}`);
|
||||||
|
|
||||||
@@ -56,13 +60,13 @@ var runService = function() {
|
|||||||
} else {
|
} else {
|
||||||
console.log('Runner listener exit with undefined return code, re-launch runner in 5 seconds.');
|
console.log('Runner listener exit with undefined return code, re-launch runner in 5 seconds.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!stopping) {
|
if (!stopping) {
|
||||||
setTimeout(runService, 5000);
|
setTimeout(runService, 5000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch(ex) {
|
} catch (ex) {
|
||||||
console.log(ex);
|
console.log(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +75,7 @@ var runService = function() {
|
|||||||
runService();
|
runService();
|
||||||
console.log('Started running service');
|
console.log('Started running service');
|
||||||
|
|
||||||
var gracefulShutdown = function(code) {
|
var gracefulShutdown = function (code) {
|
||||||
console.log('Shutting down runner listener');
|
console.log('Shutting down runner listener');
|
||||||
stopping = true;
|
stopping = true;
|
||||||
if (listener) {
|
if (listener) {
|
||||||
|
|||||||
Reference in New Issue
Block a user