From c0685ce4325e47836ace6d5e68ba7500c1ba01c1 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Fri, 21 Jul 2017 12:29:06 -0700 Subject: [PATCH] joyent/node-manta#244 mlogin could disable Manta's abort-on-core behavior Reviewed by: Joshua M. Clulow Approved by: Joshua M. Clulow --- CHANGES.md | 4 ++++ bin/mlogin | 18 +++++++++++++----- package.json | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 305ed35..5ec55a8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ## not yet released +## 4.4.3 + +- joyent/node-manta#244 mlogin could disable Manta's abort-on-core behavior + ## 4.4.2 - joyent/node-manta#312 Custom header input should tolerate ':' characters diff --git a/bin/mlogin b/bin/mlogin index ddd87e2..2e7b6a6 100755 --- a/bin/mlogin +++ b/bin/mlogin @@ -116,7 +116,7 @@ function _log(str) { } function parseOptions() { - var opts; + var opts, usercmd; try { opts = OPTIONS_PARSER.parse(process.argv); @@ -149,12 +149,20 @@ function parseOptions() { opts.path = manta.path(opts._args[0], true); } - if (opts.command) { - opts.arguments = [ '-c', opts.command ]; + /* + * The default behavior in Manta jobs is that if a process dumps core, then + * the whole task is aborted. That's not appropriate (and pretty annoying) + * for interactive use, so we run the command in our own contract that will + * ignore when a process dumps core. + */ + usercmd = opts.command; + opts.command = '/usr/bin/ctrun'; + opts.arguments = [ '-i', 'core', '-l', 'child', '/bin/bash' ]; + if (usercmd) { + opts.arguments.push('-c', usercmd); } else { - opts.arguments = [ '--norc' ]; + opts.arguments.push('--norc'); } - opts.command = '/bin/bash'; opts.running = true; opts.cancel_job = false; diff --git a/package.json b/package.json index b9dd171..6b7df03 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "type": "git", "url": "git://github.com/joyent/node-manta.git" }, - "version": "4.4.2", + "version": "4.4.3", "main": "./lib/index.js", "dependencies": { "assert-plus": "^1.0.0",