Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 8bcac73

Browse files
committed
fix for broken headless operations
Fixes #724
1 parent d66784e commit 8bcac73

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

app/headless.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ function mimicDom(app, { createWindow }, localStorage) {
248248
const isVowel = c => c === 'a' || c === 'e' || c === 'i' || c === 'o' || c === 'u'
249249
const startsWithVowel = s => isVowel(s.charAt(0))
250250
global.ui.startsWithVowel = startsWithVowel
251+
252+
global.settings = require(require('path').join(__dirname, './build/config.json'))
251253
}
252254

253255
const colorMap = {

app/plugins/ui/commands/openwhisk-core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ const owOpts = (options = {}, execOptions = {}) => {
747747
options.agent = agent
748748
}
749749

750-
if (!process.env.TEST_SPACE && !process.env.TRAVIS && settings.userAgent) {
750+
if (settings.userAgent && !process.env.TEST_SPACE && !process.env.TRAVIS) {
751751
// install a User-Agent header, except when running tests
752752
debug('setting User-Agent', settings.userAgent)
753753
options['User-Agent'] = settings.userAgent

tests/tests/passes/02/headless.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ const path = require('path'),
2424

2525
const cli = {
2626
do: cmd => new Promise((resolve, reject) => {
27-
const result = exec(`${fsh} ${cmd} --no-color`, (err, stdout, stderr) => {
27+
const command = `${fsh} ${cmd} --no-color`
28+
29+
exec(command, (err, stdout, stderr) => {
2830
if (err) {
2931
resolve({ code: err.code, output: stderr })
3032
} else {
@@ -79,6 +81,10 @@ const cli = {
7981
describe('Headless mode', function() {
8082
before(common.before(this, { noApp: true }))
8183

84+
it('should list sessions', () => cli.do('session list')
85+
.then(cli.expectOK('ok'))
86+
.catch(common.oops(this)))
87+
8288
it('should show top-level help with no arguments', () => cli.do('')
8389
.then(cli.expectError(1, 'Shell Docs / Getting Started'))
8490
.catch(common.oops(this)))

0 commit comments

Comments
 (0)