Skip to content

Commit

Permalink
If another title is running on start, exit with the ps button first
Browse files Browse the repository at this point in the history
Fixes #138
  • Loading branch information
dhleong committed Aug 27, 2020
1 parent 00a3c87 commit 6297a67
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/cli/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ module.exports = class StartCommand extends CommandOnDevice {
}

async onDevice(ui, device) {
if (device.lastInfo['running-app-titleid'] === this.titleId) {
ui.logEvent('Requested titleId already running');
return device;
}

if (device.lastInfo['running-app-titleid']) {
const appName = device.lastInfo['running-app-name'];
ui.logEvent(`"${appName}" already running; quitting it first...`);
await device.sendKeys(['ps']);
}

return device.startTitle(this.titleId);
}
};

0 comments on commit 6297a67

Please sign in to comment.