Code Monkey home page Code Monkey logo

Comments (3)

TheTripleV avatar TheTripleV commented on July 16, 2024

Ruby (tested but not reviewed):

#!/usr/bin/env ruby

require 'open3'

script_name = File.realpath(__FILE__)
jar_name = script_name.chomp(File.extname(script_name)) + '.jar'

jdk_dir = File.join(File.dirname(jar_name), '..', 'jdk', 'bin', 'java')

begin
  stdout, stderr, status = Open3.capture3("#{jdk_dir} -jar #{jar_name}")
  raise "Error launching tool:\n#{stderr}" unless status.success?
rescue
  # Start failed. Try JAVA_HOME.
  begin
    jdk_dir = File.join(ENV['JAVA_HOME'], 'bin', 'java')
  rescue
    # No JAVA_HOME. Try just running java from PATH.
    jdk_dir = 'java'
  end
  stdout, stderr, status = Open3.capture3("#{jdk_dir} -jar #{jar_name}")
  raise "Error launching tool:\n#{stderr}" unless status.success?
end

# Wait 3 seconds and print stdout/stderr if the process exits
3.times do
  sleep 1
  stdout, stderr, status = Open3.capture3("#{jdk_dir} -jar #{jar_name}")
  puts stdout
  STDERR.puts stderr
  break unless status.success?
end

from wpilibinstaller-avalonia.

auscompgeek avatar auscompgeek commented on July 16, 2024

For posterity, the script to be replaced is https://github.com/wpilibsuite/WPILibInstaller-Avalonia/blob/7e36ad377828664d4758affe143d405cb24f5e35/files/ToolsUpdater.py

from wpilibinstaller-avalonia.

ThadHouse avatar ThadHouse commented on July 16, 2024

All 3 scripts would actually need to be replaced there. And currently, these scripts are shared between linux and macos too. So there would be more work that would be necessary.

Also, if we change the extension, we'd need to update gradlerio and vscode. We'd also need to check if I launch the script as an executable, or as an argument to python in those cases (I don't remember).

from wpilibinstaller-avalonia.

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.