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

Windows issue: spaces in path #10

Open
metanoid opened this issue Aug 21, 2020 · 3 comments
Open

Windows issue: spaces in path #10

metanoid opened this issue Aug 21, 2020 · 3 comments
Assignees
Labels

Comments

@metanoid
Copy link

Running the example for cloc on Windows gives an error.

Under the hood, the system command is C:\STRAWB~1\perl\bin\perl.exe C:/Program Files/R/R-4.0.0/library/cloc/bin/cloc.pl --quiet --csv C:/Program Files/R/R-4.0.0/library/cloc/extdata

Unfortunately, there are spaces in the paths (because of Program Files) and so perl cannot find the cloc.pl script.

@hrbrmstr hrbrmstr self-assigned this Aug 21, 2020
@hrbrmstr hrbrmstr added the bug label Aug 21, 2020
hrbrmstr added a commit that referenced this issue Aug 21, 2020
@hrbrmstr
Copy link
Owner

Thx for kicking the package tyres & submitting a bug report!

I switched all the system() calls to {processx] run() calls which should fix this, but I'm not near a Windows box to test it fully. Let me know if it works and I'll close it out.

metanoid added a commit to metanoid/cloc that referenced this issue Aug 21, 2020
@metanoid
Copy link
Author

The main issue is fixed - I can run the cloc function and get output for a local file or directory now on Windows.

The test called "retrieving things from CRAN works" fails, the output of

r cran <- cloc_cran("dplyr", "https://cran.rstudio.com", .progress=FALSE)
is

              source language file_count file_count_pct loc loc_pct blank_lines blank_line_pct comment_lines comment_line_pct   pkg
1 dplyr_1.0.2.tar.gz     <NA>          0              0   0       0           0              0             0                0 dplyr

Not sure if this is a separate issue or not.

@hrbrmstr
Copy link
Owner

👍🏽

I'll have to poke at the cloc_cran() issue as it is likely Windows platform-related since:

(cran <- cloc_cran("dplyr", "https://cran.rstudio.com", .progress=FALSE))
## # A tibble: 8 x 11
##   source           language    file_count file_count_pct   loc loc_pct blank_lines blank_line_pct comment_lines comment_line_pct pkg  
##   <chr>            <chr>            <int>          <dbl> <int>   <dbl>       <int>          <dbl>         <int>            <dbl> <chr>
## 1 dplyr_1.0.2.tar… R                  185        0.407   13684 2.98e-1        3223        0.296            5749          0.397   dplyr
## 2 dplyr_1.0.2.tar… HTML                 9        0.0198   5917 1.29e-1         306        0.0281             18          0.00124 dplyr
## 3 dplyr_1.0.2.tar… Markdown             2        0.00441  1802 3.93e-2         899        0.0827              0          0       dplyr
## 4 dplyr_1.0.2.tar… C++                  9        0.0198    780 1.70e-2         198        0.0182             26          0.00179 dplyr
## 5 dplyr_1.0.2.tar… Rmd                 11        0.0242    641 1.40e-2         793        0.0729           1452          0.100   dplyr
## 6 dplyr_1.0.2.tar… C/C++ Head…          1        0.00220    99 2.16e-3          18        0.00166             0          0       dplyr
## 7 dplyr_1.0.2.tar… SVG                 10        0.0220     10 2.18e-4           0        0                   0          0       dplyr
## 8 dplyr_1.0.2.tar… SUM                227        0.5     22933 5.00e-1        5437        0.5              7245          0.5     dplyr

works on macOS and linux.

I'll keep this open until I get a chance to do that.

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

No branches or pull requests

2 participants