pd4d10 / debugtron

Debug in-production Electron based app
MIT License
1.41k stars 109 forks source link

Linux support #1

Open SoulMelody opened 5 years ago

SoulMelody commented 5 years ago

I tried to install and run debugtron on linux, but with no luck. Here is the backtrace:

debugtron /opt/github-desktop/github-desktop
internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at normalizeSpawnArguments (child_process.js:416:3)
    at spawn (child_process.js:555:16)
    at startDebugging (/usr/lib/node_modules/debugtron/lib/index.js:76:14)
    at Command.program.version.arguments.action.appPath (/usr/lib/node_modules/debugtron/lib/cli.js:11:7)
    at Command.listener (/usr/lib/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:193:13)
    at Command.parseArgs (/usr/lib/node_modules/commander/index.js:653:12)
    at Command.parse (/usr/lib/node_modules/commander/index.js:474:21)
    at Object.<anonymous> (/usr/lib/node_modules/debugtron/lib/cli.js:17:4)
SoulMelody commented 5 years ago

I have managed to make it work with the following patch applied:

diff index.js index.js.bak

30,31d29
<     case 'linux':
<       return readdirAbsolute('/opt')
58,61d55
<     case 'linux':
<       return fs.existsSync(
<         path.join(appPath, 'resources/electron.asar'),
<       )
75,78d68
<     }
<     case 'linux': {
<       const appName = path.basename(appPath)
<       return path.join(appPath, appName)

And I hope you should focus more on cross-platform development (including linux).

DuBistKomisch commented 5 years ago

:+1: patch kind of worked, except the app I was trying with didn't have a matching folder and executable name, and I couldn't pass the executable directly since it only checks if it ends with .exe :man_facepalming:

pd4d10 commented 5 years ago

Hi, @SoulMelody @DuBistKomisch , thanks for you suggestion!

Debugtron is a desktop app now! Support for linux is working in progress

pd4d10 commented 5 years ago

The latest v0.3.1 already supports Linux, which could be downloaded from releases page.

Currently we only have zip file bundle. Other bundle formats like deb and rpm are coming soon.

DuBistKomisch commented 5 years ago

@pd4d10 thanks, I just tried it out (running from yarn start, can't be bothered installing on arch linux), but it doesn't detect any apps. I tried manually navigating to an app such as /usr/bin/code, but it didn't seem to do anything, nothing in dev tools console either. what am I doing wrong?

pd4d10 commented 5 years ago

@DuBistKomisch Thanks for your quick feedback!

Electron apps detection is not ready at Linux, because there are so many Linux distributions, and their application installed paths seems quite different. It may take a while. Code here: https://github.com/bytedance/debugtron/blob/fedfb644ab7daa545e48a18fb7d755b89d763836/src/main/linux.ts#L5-L8

Could you please provide your Electron app name? I've noticed that the name is code, is it VSCode?

DuBistKomisch commented 5 years ago

fair enough, would be nice to be able to load one manually in the meantime at least.

and yeah it's VS Code: https://www.archlinux.org/packages/community/x86_64/code/

I also tried with my own app built using this packager: https://github.com/electron-userland/electron-installer-debian

pd4d10 commented 5 years ago

@DuBistKomisch Seems there are two separated problems:

By the way I'm using GitHub Desktop for test at Linux. If there are still problems on your own app, please provide your app's download link. We'll try to fix the case

DuBistKomisch commented 5 years ago

tried with latest master, seems to work with some apps (e.g. signal) which get installed to /opt :clap:

our app is available for download here: https://www.vivi.io/downloads

if I open the binary with debugtron, a tab for the app appears for a split second then goes away

pd4d10 commented 5 years ago

@DuBistKomisch Debugtron relies on --inspect switch of Node.js. Tried to run your app with --inspect and seems no inspect session started.

Which packager are you using?

thenexxuz-zz commented 4 years ago

Still not working 100%. Manjaro linux. When I tell it to open an app like GitKraken from /opt/gitkraken/gitkraken it scans it for a moment then closes BUT that only happens if the app was already OPEN. But if I open an app like GitKraken and I tell Debugtron to "rescan" then the entire interface in Debugtron goes blank.

lipei007 commented 2 years ago

is support uos arm?