Code Monkey home page Code Monkey logo

Comments (8)

drusellers avatar drusellers commented on July 30, 2024

Yeah this is odd but use a space instead of a : with the offending switch.

-d

On Feb 1, 2012, at 8:52 AM, [email protected] wrote:

I have a command line of the following form:

"c:\Some Path With Spaces\dk.exe" execute /environment:DevFit /settings:"c:\Some Path With Spaces\settings" --silent

When I execute, I get the following error:

System.InvalidOperationException: Sequence contains more than one element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source) at dropkick.Engine.DeploymentCommandLineParser.ExtractCommandToRun(IEnumerable1 commandLineElements)
at dropkick.Engine.DeploymentCommandLineParser.Set(DeploymentArguments arguments, IEnumerable`1 commandLineElements)
at dropkick.Engine.DeploymentCommandLineParser.Parse(String commandline)
at dropkick.Engine.Runner.Deploy(String commandLine)

This is a bug with the Magnum.CommandLineParser.MonadicCommandLineParser and underlying classes. I have issued a pull request (#6) in the phatboyg/Magnum project to fix the issue. Once that project is patched, dropkick will need to take in the new Magnum.dll.


Reply to this email directly or view it on GitHub:
#34

from dropkick.

rossbeehler avatar rossbeehler commented on July 30, 2024

I did figure that out for the switched arguments (Definitions in Magnum speak), but the exception above is actually from the full path to dk.exe (Arguments in Magnum speak). The workarounds of removing the spaces in my path or setting my working directory closer to dk.exe were more expensive than me just fixing it in Magnum.

Note that I also fixed the Definition switch to allow /switch:"some path with spaces".

from dropkick.

drusellers avatar drusellers commented on July 30, 2024

that's what I get trying to respond at a stop light.
I will ping chris on the fix and see where that goes. thanks.
-d

On Wed, Feb 1, 2012 at 10:14 AM, rossbeehler <
[email protected]

wrote:

I did figure that out for the switched arguments (Definitions in Magnum
speak), but the exception above is actually from the full path to dk.exe
(Arguments in Magnum speak). The workarounds of removing the spaces in my
path or setting my working directory closer to dk.exe were more expensive
than me just fixing it in Magnum.

Note that I also fixed the Definition switch to allow /switch:"some path
with spaces".


Reply to this email directly or view it on GitHub:
#34 (comment)

from dropkick.

rossbeehler avatar rossbeehler commented on July 30, 2024

After fixing this in Magnum, I found out that I was wrong in my assumption. It doesn't pass the path to dk.exe into the parser. What's happening is that the double quotes are getting removed from the value in /switch:"value", and that is done by .NET.

However, when I change it to have a space between the switch and value like:

/switch "value"

.NET still removes the double quotes, and thus those double quotes don't get into Magnum, and we're back to square 1.

Is there another workaround I'm missing?

from dropkick.

rossbeehler avatar rossbeehler commented on July 30, 2024

I made a fix in dk.exe to add double quotes back to the .NET parsed arguments so that Magnum can properly see the double quotes. This was added to pull request #31.

from dropkick.

rossbeehler avatar rossbeehler commented on July 30, 2024

I was thinking about this some more and realized that the logic to add double quotes back to the command line arguments should probably exist in Magnum and no dk.exe since System.Environment.CommandLine is globaly available . Here would be the pseudo-code in MonadicCommandLineParser:

  • foreach quotedSubstring in System.Environment.CommandLine
    • if magnumCommandLine contains quotedSubstring without double quotes around it
      • re-surround quotedSubstring with double quotes in magnumCommandLine

Let me know if that's the direction we should go, and I'll make the change in that project.

from dropkick.

mmooney avatar mmooney commented on July 30, 2024

Hi @rossbeehler, where did you end up with this? I'm running into the same issue, my settings file path has spaces in it and it's blowing up the MonadicCommandLineParser. Was there a resolution or workaround for this?

Thanks

from dropkick.

rossbeehler avatar rossbeehler commented on July 30, 2024

@mmooney I believe this should have been fixed with pull request #31 according to my above comment, but then I also patched it in Magnum: phatboyg/Magnum@7a170f1.

from dropkick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.