Skip to content

Shell command call is causing applications crash or hangs-up. #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
unoravi opened this issue Mar 17, 2021 · 9 comments
Closed

Shell command call is causing applications crash or hangs-up. #39

unoravi opened this issue Mar 17, 2021 · 9 comments

Comments

@unoravi
Copy link

unoravi commented Mar 17, 2021

To execute shell commands on desktop platforms, I am using process_run dependency. Sample code as shown below.

var shell = Shell();
var res = await shell.run("ls");
print(res.outLines);

Application hangup or crash at the time of execution of second line. Please provide a latest solution for this issue. Here is the flutter doctor -v

[✓] Flutter (Channel dev, 2.1.0-10.0.pre, on Linux, locale en_GB.UTF-8)
    • Flutter version 2.1.0-10.0.pre at /home/ravi/flutter
    • Framework revision cc9b78fc5c (3 weeks ago), 2021-02-25 13:26:03 -0800
    • Engine revision a252ec09b7
    • Dart version 2.13.0 (build 2.13.0-77.0.dev)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version 1.52.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux
    • Chrome (web)    • chrome • web-javascript • Google Chrome 88.0.4324.146

! Doctor found issues in 2 categories.

Thanks

@alextekartik
Copy link
Contributor

It seems you are on flutter master channel. Does it work on stable?

@unoravi
Copy link
Author

unoravi commented Mar 18, 2021

@alextekartik
I am working on DEV channel. Issue exists on flutter doctor environment as shown above.. Please let me know if you need more details.

If you can't replicate this issue with this command then try "ip addr" command instead of "ls" command.

@alextekartik
Copy link
Contributor

Are you on the latest version of process_run (0.11.2 / 0.12.1) and if not can you try a pub upgrade. A log of the crash would be helpful as I cannot reproduce (although I'm suspecting an issue similar to #32 which should be fixed). Also, as I asked before, does it work on flutter stable?

@unoravi
Copy link
Author

unoravi commented Mar 18, 2021

I am using process_run : 0.11.2 and not able to upgrade to 0..12.1 because of another issue : #40

@alextekartik
Copy link
Contributor

Can you provide a log of the crash? 0.11.2 (pre-nnbd) should be fine.

@unoravi
Copy link
Author

unoravi commented Mar 19, 2021

@alextekartik
It directly hangs-up application there is no log found for this. I will keep trying to get log using logger and will share if found anything.

@alextekartik
Copy link
Contributor

Can you try to wrap with a try/catch and print the error and stacktrace?

@unoravi
Copy link
Author

unoravi commented Mar 23, 2021

@alextekartik
It's already wrapped in TRY/CATCH but there is no issue detail I found. It hang app directly or crash no log or details found.

@alextekartik
Copy link
Contributor

alextekartik commented Mar 23, 2021

Ok, let's try the good old printf debugging (I'm assuming you're on Linux), can you try this in your main() to see what the logs give and whether it hangs (sorry if you already tried, I don't have much idea on what to try next):

  print('Before');
  try {
    var shell = Shell();
    var res = await shell.run('ls');
    print(res.outLines);
  } catch (e) {
    print('error: $e');
  }
  print('After');

Please try on the beta or stable channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants