Git Product home page Git Product logo

Comments (5)

bufferUnderrun avatar bufferUnderrun commented on May 27, 2024

i follow the wiki and await-ing is not working :

var result = await $"dir";
WriteLine(result.ExitCode);
result.StdOut.ForEach(WriteLine);

Resulting

Script compilation failure! See diagnostics below.

Nake.csx(26,1): error CS0670: Field cannot have void type
Nake.csx(27,17): error CS0023: Operator '.' cannot be applied to operand of type 'void'
Nake.csx(28,7): error CS0023: Operator '.' cannot be applied to operand of type 'void'

So where i miss the point ?

Thanks for your help.

from nake.

bufferUnderrun avatar bufferUnderrun commented on May 27, 2024

Same for the official doc in the readme.md : copy/paste and running code throw error.
For the last v3.0, the starting template looks like :

#r "nuget: Nake.Meta" // for Nake attribute
#r "nuget: Nake.Utility" // for all other class

using Nake;
using static Nake.Shell;
using static System.Console;

[Nake] void Default() {
    Console.WriteLine("Default();");
    Nake.Session.Exit("ok");
}

from nake.

yevhen avatar yevhen commented on May 27, 2024

Uh, somehow lost this issue.

@bufferUnderrun I'll check that. But I swear awaiting works fine. I use it extensively here https://github.com/yevhen/Streamstone/blob/master/Nake.csx

from nake.

stratdev3 avatar stratdev3 commented on May 27, 2024

I found the issue : await works but does not return any value whereas the wiki documentation says it can.

Working

#r "nuget: Nake.Meta" // for Nake attribute
#r "nuget: Nake.Utility" // for all other class

using Nake;
using static Nake.Shell;
using static System.Console;

[Nake] async Task Default() {
    await $"dir";
    Nake.Session.Exit("ok");
}

Not working

#r "nuget: Nake.Meta" // for Nake attribute
#r "nuget: Nake.Utility" // for all other class

using Nake;
using static Nake.Shell;
using static System.Console;

[Nake] async Task Default() {
    var result = await $"dir";
    Nake.Session.Exit("ok");
}

Error

Script compilation failure! See diagnostics below.
C:\www\appweb\src\nake.csx(78,9): error CS0815: Cannot assign void to an implicitly-typed variable

One last question : What is the difference between Cmd("dir"); and await $"dir"; ?

Thanks for you help

from nake.

yevhen avatar yevhen commented on May 27, 2024

@stratdev3 I'll check this and get back to you

from nake.

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.