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

[BUG] Space inside project path causes failure #103

Closed
znjameswu opened this issue Aug 10, 2020 · 11 comments · Fixed by #113
Closed

[BUG] Space inside project path causes failure #103

znjameswu opened this issue Aug 10, 2020 · 11 comments · Fixed by #113
Labels
bug Something isn't working

Comments

@znjameswu
Copy link

Dart SDK version: 2.9.0
fvm version: 1.1.5
Platform: win10 x64

I happen to have a space in my project path. And when I run 'fvm flutter`, it causes failure. Something like:

PS C:\Users\FIRST_NAME LAST_NAME\Projects\PROJECT_NAME> fvm flutter
'C:\Users\FIRST_NAME' is not recognized as an internal or external command,
operable program or batch file.
@znjameswu znjameswu added the bug Something isn't working label Aug 10, 2020
@leoafarias
Copy link
Owner

@znjameswu I need a bit more information on this. It seems that FVM was not installed.
Did you install using pub global activate fvm?

@znjameswu
Copy link
Author

znjameswu commented Aug 10, 2020

@znjameswu I need a bit more information on this. It seems that FVM was not installed.
Did you install using pub global activate fvm?

Oh yes, I just found out it was due to fvm not installed. The installation process seems to have some kind of issue (fvm install stable still returns 'C:\Users\FIRST_NAME' is not recognized as an internal or external command, operable program or batch file.). I manually installed using

git clone -c advice.detachedHead=false --progress --depth 1 --single-branch -b stable --depth 1 https://github.com/flutter/flutter.git "C:\Users\****\fvm\versions\stable"

copied from fvm install stable --verbose output. After the installation it was fine. Maybe I need more trial to locate that issue.

@znjameswu
Copy link
Author

FYI, the error output of fvm install *** just doesn't make sense to me for now. I'm not sure why would it pop such an error. I'll post it here anyway.

PS C:\Users\****\Projects\flutter\flutter_math> fvm install beta --verbose
beta exists but was not setup correctly. Doing cleanup...
Installing version: beta:
$ git clone -c advice.detachedHead=false --progress --depth 1 --single-branch -b beta --depth 1 https://github.com/flutter/flutter.git "C:\Users\****\fvm\versions\beta"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
[     0.303s] ⚠️  Could not install Flutter version: beta.
#0      gitCloneCmd (package:fvm/flutter/flutter_tools.dart:57:5)
<asynchronous suspension>
#1      installRelease (package:fvm/utils/installer.dart:21:9)
#2      InstallCommand.run (package:fvm/commands/install.dart:50:11)
<asynchronous suspension>
#3      CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#4      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#5      new Future.sync (dart:async/future.dart:223:31)
#6      CommandRunner.run (package:args/command_runner.dart:112:14)
#7      fvmRunner (package:fvm/fvm.dart:26:23)
#8      main (file:///C:/Toolkits/flutter/.pub-cache/hosted/pub.dartlang.org/fvm-1.1.5/bin/main.dart:4:9)
#9      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Unhandled exception:
ExceptionCouldNotClone: Could not install Flutter version: beta.
#0      gitCloneCmd (package:fvm/flutter/flutter_tools.dart:57:5)
<asynchronous suspension>
#1      installRelease (package:fvm/utils/installer.dart:21:9)
#2      InstallCommand.run (package:fvm/commands/install.dart:50:11)
<asynchronous suspension>
#3      CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#4      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#5      new Future.sync (dart:async/future.dart:223:31)
#6      CommandRunner.run (package:args/command_runner.dart:112:14)
#7      fvmRunner (package:fvm/fvm.dart:26:23)
#8      main (file:///C:/Toolkits/flutter/.pub-cache/hosted/pub.dartlang.org/fvm-1.1.5/bin/main.dart:4:9)
#9      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
'pub' is not recognized as an internal or external command, operable program or batch file

@leoafarias leoafarias reopened this Aug 11, 2020
@leoafarias
Copy link
Owner

I will take a look seems Windows specific.

@leoafarias
Copy link
Owner

@znjameswu I made an adjustment on how it calls the commands on windows. Could you try the latest version 1.1.7.

Not sure why this would happen since fvm uses the path package to ensure compatibility with different OSs

@znjameswu
Copy link
Author

I tested installing other versions of Flutter. It seems fine now.

@znjameswu znjameswu reopened this Aug 18, 2020
@znjameswu
Copy link
Author

I was able to reproduce this bug in a minimal reproducible settings. Seems like a process_run bug, but I'm not familiar.

Demo

import 'package:process_run/cmd_run.dart';
import 'package:process_run/process_run.dart';

void main(List<String> arguments) async{
  final version = 'master';
  final kFlutterRepo = 'https://github.com/flutter/flutter.git';
  final versionDirectoryPath = r'ANY_PATH_WITH_A_SPACE_INSIDE';
  final args = [
    'clone',
    '-c',
    'advice.detachedHead=false',
    '--progress',
    '--depth',
    '1',
    '--single-branch',
    '-b',
    version,
    '--depth',
    '1',
    kFlutterRepo,
    versionDirectoryPath
  ];
  final process = await run(
    'git',
    args,
    // stdout: stdout,
    // stderr: stderr,
    verbose: true,
    // runInShell: Platform.isWindows,
  );
}

It will output

$ git clone -c advice.detachedHead=false --progress --depth 1 --single-branch -b master --depth 1 https://github.com/flutter/flutter.git "PATH"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

What is curious is that the logged git command is perfectly legal but there will always be an error starting with 'C:\Program'. So I suspect a bug in process_run. Maybe you can identify it.

@znjameswu
Copy link
Author

@leoafarias process_run has fixed the above issue in 0.10.12+2. Upgrading the dependency should fix this problem.

@leoafarias
Copy link
Owner

Thanks @znjameswu I have deployed 1.2.2

@leoafarias
Copy link
Owner

@all-contributors please add znjameswu for bug

@allcontributors
Copy link
Contributor

@leoafarias

I've put up a pull request to add @znjameswu! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants