Skip to content
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

when call shell.kill(), Error: FileSystemException: writeFrom failed, path = '' (OS Error: 句柄无效。 , errno = 6) #109

Open
lunxinfeng opened this issue May 7, 2024 · 6 comments

Comments

@lunxinfeng
Copy link

image

here is the demo, only push a new page , then pop:

class _SecondPageState extends State<SecondPage> {
  Shell shell = Shell();

  @override
  void initState() {
    super.initState();
    // runShell();
  }

  @override
  void dispose() {
    super.dispose();
    shell.kill();
  }

  Future runShell() async {
    await shell.cd(r'D:\data\projects\magic_box').runExecutableArguments('git', ['status']);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(),
    );
  }
}

process_run: ^0.14.2
flutter: 3.19.0
windows 11 or 10

@lunxinfeng
Copy link
Author

and the code is fine when "flutter run -d W", but error when start by "app.exe", only error once

@lunxinfeng
Copy link
Author

the main code:

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  PlatformDispatcher.instance.onError = (error, stack) {
    ScaffoldMessenger.of(appContext).showSnackBar(SnackBar(content: Text('错误:${error.toString()}\n${stack.toString()}')));
    return true;
  };
  runApp(const MyApp());
}

@yzkj2213
Copy link

yzkj2213 commented May 8, 2024

I found if remove this code, it work fine!

image

@alextekartik
Copy link
Contributor

alextekartik commented May 14, 2024

@yzkj2213 Thanks for the report. Are you able to catch and print the exception if you don't comment this line (sorry since I cannot reproduce)?

@lunxinfeng
Copy link
Author

@yzkj2213 Thanks for the report. Are you able to catch and print the exception if you don't comment this line (sorry since I cannot reproduce)?

Thanks. the yzkj2213 is my other account, the error log and demo is in the first floor, top .

It only error when pack a exe file, I feel very confused, but not konw why

when run by "flutter run -d W", it worked fine

@alextekartik
Copy link
Contributor

@lunxinfeng Ok I see that you provide a way to reproduce (using a git command), I'll try to reproduce on Windows (that I don't test very often).

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

3 participants