Skip to content

Commit

Permalink
Merge pull request #47 from neuromotion/develop
Browse files Browse the repository at this point in the history
fix launching of tasks
  • Loading branch information
fernandogelin authored Apr 22, 2020
2 parents 7d0ee2f + 61eb207 commit 079347a
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 58 deletions.
185 changes: 137 additions & 48 deletions electron-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dependencies": {
"electron-protocol-serve": "^1.3.0",
"electron-squirrel-startup": "^1.0.0",
"execa": "^4.0.0",
"zeromq": "^6.0.0-beta.6"
},
"devDependencies": {
Expand Down
19 changes: 10 additions & 9 deletions electron-app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-env node */
const { app, BrowserWindow, protocol, ipcMain } = require('electron');
const path = require('path');

if (require('electron-squirrel-startup')) return app.quit();

Expand Down Expand Up @@ -101,20 +102,20 @@ ipcMain.on('request', (event, args) => {
})

// Functions to launch jsPsych tasks
// Beads

const execa = require('execa')

ipcMain.on('taskSpawn', (event, args) => {
const spawn = require('child_process').spawn;
const home = app.getPath('home');
spawn(`${home}\\AppData\\Local\\${args.taskPath}`, {
cwd: process.cwd(),
env: {
const fullPath = path.join(home, 'AppData', 'Local', args.taskPath)
execa(fullPath,
{
env: {
REACT_APP_AT_HOME: true
},
stdio: 'inherit'
})
}
}).stdout.pipe(process.stdout)
})


// Handle an unhandled error in the main thread
//
// Note that 'uncaughtException' is a crude mechanism for exception handling intended to
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 079347a

Please sign in to comment.